package com.cjj2016.cjj.mycanvasdemo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button btn_DrawAxis = (Button) findViewById(R.id.btn_DrawAxis);
        btn_DrawAxis.setOnClickListener(this);

        Button btn_DrawARGB = (Button) findViewById(R.id.btn_DrawARGB);
        btn_DrawARGB.setOnClickListener(this);

        Button btn_DrawText = (Button) findViewById(R.id.btn_DrawText);
        btn_DrawText.setOnClickListener(this);


        Button btn_DrawPoint = (Button) findViewById(R.id.btn_DrawPoint);
        btn_DrawPoint.setOnClickListener(this);

        Button btn_DrawLine = (Button) findViewById(R.id.btn_DrawLine);
        btn_DrawLine.setOnClickListener(this);

        Button btn_DrawRect = (Button) findViewById(R.id.btn_DrawRect);
        btn_DrawRect.setOnClickListener(this);

        Button btn_DrawCircle = (Button) findViewById(R.id.btn_DrawCircle);
        btn_DrawCircle.setOnClickListener(this);

        Button btn_DrawOval = (Button) findViewById(R.id.btn_DrawOval);
        btn_DrawOval.setOnClickListener(this);


        Button btn_DrawArc = (Button) findViewById(R.id.btn_DrawArc);
        btn_DrawArc.setOnClickListener(this);

        Button btn_DrawPath = (Button) findViewById(R.id.btn_DrawPath);
        btn_DrawPath.setOnClickListener(this);

        Button btn_DrawBitmap = (Button) findViewById(R.id.btn_DrawBitmap);
        btn_DrawBitmap.setOnClickListener(this);

    }


    @Override
    public void onClick(View v) {
        int drawmodel = 0;

        switch (v.getId()){
            case R.id.btn_DrawAxis:
                drawmodel = MyView.DRAWMODE_AXIS;
                break;
            case R.id.btn_DrawARGB:
                drawmodel = MyView.DRAWMODE_ARGB;
                break;
            case R.id.btn_DrawText:
                drawmodel = MyView.DRAWMODE_TEXT;
                break;
            case R.id.btn_DrawPoint:
                drawmodel = MyView.DRAWMODE_POINT;
                break;
            case R.id.btn_DrawLine:
                drawmodel = MyView.DRAWMODE_LINE;
                break;
            case R.id.btn_DrawRect:
                drawmodel = MyView.DRAWMODE_RECT;
                break;
            case R.id.btn_DrawCircle:
                drawmodel = MyView.DRAWMODE_CIRCLE;
                break;
            case R.id.btn_DrawOval:
                drawmodel = MyView.DRAWMODE_OVAL;
                break;
            case R.id.btn_DrawArc:
                drawmodel = MyView.DRAWMODE_ARC;
                break;
            case R.id.btn_DrawPath:
                drawmodel = MyView.DRAWMODE_PATH;
                break;
            case R.id.btn_DrawBitmap:
                drawmodel = MyView.DRAWMODE_BITMAP;
                break;
        }

        Intent intent = new Intent(this,CanvasActivity.class);
        intent.putExtra("drawModel",drawmodel);
        startActivity(intent);

    }
}
